Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 2 - Movie Toolbox / Movie Toolbox Reference
Functions for Getting and Playing Movies / Creating Tracks and Media Structures


NewTrackMedia

After you have created a new track, you can create a media for the track by calling the NewTrackMedia function. The media refers to the actual data samples used by the track.

pascal Media NewTrackMedia (Track theTrack, OSType mediaType, 
                            TimeScale timeScale, Handle dataRef, 
                            OSType dataRefType);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack (described on page 2-136).
mediaType
Specifies the type of media to create. The Movie Toolbox uses this value to find the correct media handler for the new media. If the toolbox cannot locate an appropriate media handler, it returns an error. The following types are available:
 VideoMediaTypeVideo media
 SoundMediaTypeSound media
 TextMediaTypeText media
timeScale
Defines the media's time coordinate system.
dataRef
Specifies the data reference. This parameter contains a handle to the information that identifies the file that contains this media's data. The type of information stored in that handle depends upon the value of the dataRefType parameter.
If you are creating a new media that refers to existing media data, you can use the GetMediaDataRef function (described on page 2-201) to obtain information about the existing data reference. You can then supply information about that reference to this function.
Set this parameter to nil to use the file that is associated with the movie or if the movie does not have a movie file. For example, if you have created the movie using the CreateMovieFile function (described on page 2-84) or the NewMovieFromFile function (described on page 2-76), the Movie Toolbox assumes that the movie's data resides in the file specified at that time. If you have created the movie using the NewMovieFromScrap or NewMovie functions (described on page 2-229 and page 2-80, respectively), the movie does not have a movie file.
dataRefType
Specifies the type of data reference. If the data reference is an alias, you must set this parameter to rAliasType ('alis'), indicating that the reference is an alias. See Inside Macintosh: Files for more information about aliases and the Alias Manager.
If you are creating a new media that refers to existing media data, you can use the GetMediaDataRef function (described on page 2-201) to obtain information about the existing data reference. You can then supply information about that reference to this function.
Set this parameter to nil to use the file that is associated with the movie or if the movie does not have a movie file. For example, if you have created the movie using the CreateMovieFile function (described on page 2-84) or the NewMovieFromFile function (described on page 2-76), the Movie Toolbox assumes that the movie's data resides in the file specified at that time. If you have created the movie using the NewMovieFromScrap or NewMovie functions (described on page 2-229 and page 2-80, respectively), the movie does not have a movie file.
DESCRIPTION
The NewTrackMedia function returns a media identifier. If the function cannot create the new media, it sets this returned value to nil.

ERROR CODES
cantFindHandler-2003Cannot locate a handler
cantOpenHandler-2004Cannot open a handler
noMediaHandler-2006Media has no media handler
invalidTrack-2009This track is corrupted or invalid
invalidTime-2015This time value is invalid
Memory Manager errors


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996